import request from '@/utils/request'

// 获得学生列表 /students/getStudents
/* 
  @ param  any
     作为需要向后端传递的参数
     注意 get param
         post  body
*/
let getStudents = async (params) => {
    let result = await request({
        method: 'GET',
        url: '/students/getStudents',
        params: {
            ...params,
            role: "students"
        }
    })
    return result
}

// 带审核学生列表 /students/getUnOpenStudent
let getUnOpenStudent = async (params) => {
    let result = await request({
        method: 'GET',
        url: '/students/getUnOpenStudent',
        params: {
            ...params,
            role: "students"
        }
    })
    return result
}


// 通过学号删除学员 /students/delStudent

let delStudent = async (params) => {
    let result = await request({
        method: 'post',
        url: '/students/delStudent',
        data: {
            ...params,
            role: "students"
        }
    })
    return result
}

// 修改学生信息 /students/updateStudent
let updateStudent = async (params) => {
    let result = await request({
        method: 'post',
        url: '/students/updateStudent',
        data: {
            ...params,
            role: "students"
        }
    })
    return result
}

// 学生新增 /students/addStudent
let addStudent = async (params) => {
    let result = await request({
        method: 'post',
        url: '/students/addStudent',
        data: {
            ...params,
            role: "students"
        }
    })
    return result
}

export default {
    getStudents,
    delStudent,
    updateStudent,
    addStudent,
    getUnOpenStudent
}